import { defineStore } from "pinia";
import useSettingsStore from "./settings.js"

export const useEpThemeStoreHook = defineStore("epTheme", {
  state: () => ({
    epThemeColor: useSettingsStore().themeConfig.epThemeColor,
    epTheme: useSettingsStore().themeConfig.themeColor
  }),
  getters: {
    getEpThemeColor(state) {
      return state.epThemeColor;
    },
    /** 用于mix导航模式下hamburger-svg的fill属性 */
    fill(state) {
      if (state.epTheme === "light") {
        return "#409eff";
      } else {
        return "#fff";
      }
    }
  },
  actions: {
    setEpThemeColor(newColor) {
      this.epThemeColor = newColor;
      useSettingsStore().changeThemeConfig({ key: 'epThemeColor', value: newColor })
    }
  }
});

